/**
 * @file       CKeyboardListener.h
 * @brief      The  class for event listeners that dispatch the user input event
 * @author     Huabo Zheng
 * @date       Jan 13, 2012
 * @Copyright  2012, www.netgear.com Inc. All rights reserved.
 */

#ifndef CKEYBOARDLISTENER_H_
#define CKEYBOARDLISTENER_H_

#include "IEventListener.h"
#include "typedefine.h"

namespace NS_LCD_AFW
{
class CFrame;
/**
 *NS_LCD_AFW::CKeyboardListener
 */


/**
 *@class  CKeyboardListener
 *@brief  The  class for event listeners that dispatch the user input event
 */
class CKeyboardListener: public NS_LCD_AFW::IEventListener
{
public:

	/**
	 *@brief Constructor
	 *@attention This objects can only be create in the heap memory and call destroy() for destruction
	 *@see destory
	 */
	CKeyboardListener();

	/**
	 *@brief Constructor
	 *@details Constructor
	 *@param[in]  pEventHandler A pointer to a CEventHandler object that responsible for handling events
	 *@param[in]  bAutoRelease Indicate that the object is freed by the caller or by the Callee
	 *@note
	 *@attention This objects can only be create in the heap memory and call destroy() for destruction
	 *@see destory
	*/
	CKeyboardListener(CEventHandler *pEventHandler, bool bAutoRelease = true);

	/**
	 *@brief Constructor
	 *@details Constructor
	 *@param[in]  pEventHandler A pointer to a CEventHandler object that responsible for handling events
	 *@param[in] eventId Specify the event ID that the listener interested in
	 *@param[in] callBack when the interesting event occurs,the listener will call the callBack function to process
	 *@param[in] param Specify the param that pass to the callBack function when event occurs
	 *@param[in]  bAutoRelease Indicate that the object is freed by the caller or by the Callee
	 *@note
	 *@attention This objects can only be create in the heap memory and call destroy() for destruction
	 *@see destory
	*/
	CKeyboardListener(CEventHandler *pEventHandler, int interestEventId,
			AFW_EventCallBack callBack, int param = INVALID_PARAM,
			bool bAutoRelease = true);
protected:
	/**
	*@brief DeConstructor
	*@attention This objects can only be create in the heap memory and call destroy() for destruction
	*@see destory()
	*/
	virtual ~CKeyboardListener();

public:

	/**
	 *@brief Event dispatcher
	 *@details Dispatch event to the handler or callback function
	 *@param[in] pEvent A pointer to a CAppEvent object
	 *@exception none
	 *@retval    int
	 *@return    ERR_SUCCESS if success,ERR_NOT_KEYBOARD_EVENT if the input param is not the type of CKeyboardEvent, otherwise failure
	 *@note
	 *@attention
	 *@see
	 */
	virtual int actionPerformed(IEvent *pEvent);

private:
	DISABLE_COPY_CONSTRUCTOR_AND_ASSIGN_REFERENCE(CKeyboardListener);
};

} /* namespace NS_LCD_AFW */
#endif /* CKEYBOARDLISTENER_H_ */
